<style type="text/css">
.upload {
    width: 230px;
    height: 200px;
    position: relative;
}
#show_image{
    position: absolute;
    top: 78px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function(){
	jQuery('.customselect').customSelect();
	jQuery('.register_form input[type="text"],.register_form input[type="password"]').focus(function(){
		jQuery(this).parent('p').addClass('pfocus');
	});
	jQuery('.register_form input[type="text"],.register_form input[type="password"]').focusout(function(){
		jQuery(this).parent('p').removeClass('pfocus');
	});
	jQuery('.register_form input[type="text"],.register_form input[type="password"]').mouseover(function(){
		jQuery(this).parent('p').addClass('phover');
	});
	jQuery('.register_form input[type="text"],.register_form input[type="password"]').mouseout(function(){
		jQuery(this).parent('p').removeClass('phover');
	});
	jQuery(".position_main").height(jQuery(window).height());
	jQuery('.content_text').slimScroll({
		height:'500px',
		railVisible: true,
		color:'#646673',
		size:'12px',
		railOpacity: 1,
		alwaysVisible: true
	});
});

$(function(){
    showImg = {
        UpdatePreview: function(obj){
          // if IE < 10 doesn't support FileReader
          if(!window.FileReader){
             // don't know how to proceed to assign src to image tag
          } else {
             var reader = new FileReader();
             var target = null;

             reader.onload = function(e) {
              target =  e.target || e.srcElement;
               $("#show_image").prop("src", target.result);
             };
              reader.readAsDataURL(obj.files[0]);
          }
        }
    };
});
$(function(){
  $("div.avarta_edit").hover(function(){$("#show_image").fadeOut(500);},function(){$("#show_image").fadeIn(500)});  
});
</script>
<div class="content">
	<div class="two-column">
		<form class="content_form register_form" action="<?php echo Yii::app()->createUrl('user/update',array('id' => $user['id'])); ?>" method="POST" enctype="multipart/form-data" >
			<div class="one_column left_column">
				<h2>Chỉnh sửa thông tin cá nhân</h2>
				<p><i>*Hãy sử dụng thông tin thật, bạn nhé!</i></p>
				
				<p class="input_wrapper"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_email.png" /><input type="text" value="<?php echo $user['email']; ?>" disabled /></p>
				<p class="input_wrapper"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_user_old.png" /><input type="text" name="User[name]" value="<?php echo $user['name'] ?>" /></p>
				<p><img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_date.png" /><select class="customselect smallselect" name="day">
					<?php for($i = 1;$i <= 31; $i++) : ?>
						<?php if($user['birthday'][0] == $i) : ?>
							<option selected value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php else : ?>
							<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php endif; ?>
					<?php endfor; ?>
				</select>
				<select class="customselect smallselect" name="month">
					<?php for($i = 1;$i <= 12; $i++) : ?>
						<?php if($user['birthday'][1] == $i) : ?>
							<option selected value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php else : ?>
							<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php endif; ?>
					<?php endfor; ?>
				</select>
				<select class="customselect mediumselect" name="year">
					<?php for($i = 1945;$i <= date("Y") - 1; $i++) : ?>
						<?php if($user['birthday'][2] == $i) : ?>
							<option selected value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php else : ?>
							<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
						<?php endif; ?>
					<?php endfor; ?>
				</select>
			</p>

			<p class="input_wrapper"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_sex.png" />
			<label class="sex">Giới Tính</label>
			<?php if($user['gender'] == '0') : ?>
			<label class="label_radio" for="male-check">
			<input name="User[gender]" value="0" checked id="male-check" type="radio" /> Nam</label>
			<label class="label_radio" for="female-check">
			<input name="User[gender]" value="1" id="female-check" type="radio" /> Nữ</label>
			<?php else : ?>
			<label class="label_radio" for="male-check">
			<input name="User[gender]" value="0" id="male-check" type="radio" /> Nam</label>
			<label class="label_radio" for="female-check">
			<input name="User[gender]" checked value="1" id="female-check" type="radio" /> Nữ</label>
			<?php endif; ?></p>
			<p class="input_wrapper"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_call.png" /><input type="text" name="User[phone]" value="<?php echo $user['phone']; ?>" /></p>
			<p><input type="submit" value="Lưu lại" /><input type="reset" value="Hủy bỏ" /></p>

		</div>
		<div class="one_column left_column">
			<div class="avarta_edit" >
				<a class="choose_btn">Chọn ảnh</a>
				<input type="file" accept="image/*" name="User[avatar_url]" class="choose_btn1" style="display:none;" onchange="showImg.UpdatePreview(this)" />
                <img id="show_image" src="./../images/avatar/<?php echo $user['avatar_url'];?>" width="139" height="136" class="show_Img"/>
				<script type="text/javascript">
					$(".choose_btn").click(function () {
					    $(".choose_btn1").trigger('click');
					});
				</script>
			</div>
		</div>
	</form>
</div>

</div>